import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GarageInfoVO, GarageInfoForm, GarageInfoQuery } from '@/api/business/garageInfo/types';

/**
 * 查询车位列表
 * @param query
 * @returns {*}
 */

export const listGarageInfo = (query?: GarageInfoQuery): AxiosPromise<GarageInfoVO[]> => {
  return request({
    url: '/business/garageInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车位详细
 * @param garageId
 */
export const getGarageInfo = (garageId: string | number): AxiosPromise<GarageInfoVO> => {
  return request({
    url: '/business/garageInfo/' + garageId,
    method: 'get'
  });
};

/**
 * 新增车位
 * @param data
 */
export const addGarageInfo = (data: GarageInfoForm) => {
  return request({
    url: '/business/garageInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改车位
 * @param data
 */
export const updateGarageInfo = (data: GarageInfoForm) => {
  return request({
    url: '/business/garageInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除车位
 * @param garageId
 */
export const delGarageInfo = (garageId: string | number | Array<string | number>) => {
  return request({
    url: '/business/garageInfo/' + garageId,
    method: 'delete'
  });
};
